package cn.cloud9.designpattern.dp10adapter;

import cn.cloud9.designpattern.dp10adapter.class_style.AC220;
import cn.cloud9.designpattern.dp10adapter.class_style.DC5;

/**
 * @projectName: Java
 * @author: 戴知舟
 * @date: 2022年05月25日 10:57
 * @version: 1.0
 */
public class Test {
    public static void main(String[] args) {

        // 继承式适配器模式
        DC5 dc5 = new cn.cloud9.designpattern.dp10adapter.class_style.PowerAdapter();
        int output5V = dc5.output5V();

        cn.cloud9.designpattern.dp10adapter.class_style.PowerAdapter adapter =
                new cn.cloud9.designpattern.dp10adapter.class_style.PowerAdapter();
        int i = adapter.outPutAC220V();

        System.out.println(" - - - - -");

        // 对象式适配器模式
        cn.cloud9.designpattern.dp10adapter.object_style.PowerAdapter adapter2 =
                new cn.cloud9.designpattern.dp10adapter.object_style.PowerAdapter(new AC220());
        i = adapter2.outPutAC220V();
        adapter2.output5V();


    }
}
